﻿
@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>SB Admin 2 - Bootstrap Admin Theme</title>
    <link href="/admin2/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/admin2/vendor/metisMenu/metisMenu.min.css" rel="stylesheet" />
    <link href="~/admin2/dist/css/sb-admin-2.min.css" rel="stylesheet" />
    <link href="/admin2/vendor/morrisjs/morris.css" rel="stylesheet" />
    <link href="/admin2/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-md-4 col-md-offset-4">
                <div class="login-panel panel panel-default">
                    <div class="panel-heading" style="text-align:center">
                        <h class="panel-title">一站一档系统登录</h>
                    </div>
                    <div class="panel-body">
                        
                            <fieldset>
                                <div class="form-group">
                                    <input class="form-control" placeholder="用户名" id="name" name="name" autofocus>
                                </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="密码" id="pwd" name="pwd" type="password" value="">
                                </div>
                                <div class="form-group">
                                    <input class="form-control" style=" width:45%; display:inline-block" placeholder="验证码" name="codes" id="codes" type="text" value="">
                                    <img width="45%" id="valcode" height="30" src="/Login/ShowValidateCode" style="text-align:right; display:inline-block; float:right;" class="pic" onclick="changeCheckCode(this);" />

                                </div>
                                @*<div class="checkbox">
                                    <label>
                                        <input name="remember" type="checkbox" value="Remember Me">Remember Me
                                    </label>
                                </div>*@
                                <!-- Change this to a button or input when using this as a form -->
                                <a  class="btn btn-lg btn-success btn-block" onclick="Login()" >登录</a>
                            </fieldset>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="/admin2/vendor/jquery/jquery.min.js"></script>
    <script src="/admin2/vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="/admin2/vendor/metisMenu/metisMenu.min.js"></script>
    <script src="/admin2/dist/js/sb-admin-2.min.js"></script>
</body>
</html>
<script>
    function Login() {
        var name = $("#name").val();
        var pwd = $("#pwd").val();
        var codes = $("#codes").val();
        $.post("/Login/LoginHandle", { name: name, pwd: pwd, codes: codes }, function (result) {
            if (!result.res) {
                alert(result.msg);
            } else {
                @*location.href = "@Request["url"]";*@
                location.href = "/Modular";
            }
        }, "json");
    }
    function changeCheckCode(obj) {


        $(obj).attr("src", "/Login/ShowValidateCode" + "/" + GetRandomNum(1, 100));  //id=2
    }
    function GetRandomNum(Min, Max) {
        var Range = Max - Min;
        var Rand = Math.random();
        return (Min + Math.round(Rand * Range));
    }
</script>

